package com.heatingcharge.controller.charge;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heatingcharge.common.util.R;
import com.heatingcharge.param.ChargeRefundParam;
import com.heatingcharge.param.SearchParam;
import com.heatingcharge.service.charge.IChargeRefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 退费表 前端控制器
 * </p>
 *
 * @author devin.jiang
 * @since 2019-11-20
 */
@RestController
@RequestMapping("/charge-refund")
public class ChargeRefundController {

    @Autowired
    IChargeRefundService chargeRefundService;

    @GetMapping
    public R getChargeRefunds(Page page, SearchParam searchParam){
        return R.ok(chargeRefundService.getChargeRefund(page,searchParam));
    }

    @PostMapping
    public R saveChargeRefund(@RequestBody ChargeRefundParam chargeRefundParam){
        if (chargeRefundService.saveChargeRefund(chargeRefundParam)>0){
            return R.ok();
        }
        return R.error("退费失败");
    }
}


